package de.carcophan.archiver;

import com.google.inject.Singleton;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * Created by  on 15.04.2014.
 */
@Singleton
public class Config {

    private static final Logger logger = LogManager.getLogger(Config.class);
    private PropertiesConfiguration configuration;

    public Config() {
        init();
    }

    private void init() {
        try {
            configuration = new PropertiesConfiguration("conf/config.properties");
        } catch (ConfigurationException e) {
            logger.error("error in Config.", e);
            throw new RuntimeException(e);
        }
    }

    public int getBackupInterval() {
        int interval = configuration.getInt("backup.interval");
        return interval;
    }

    public String getSrcDir() {
        String src = configuration.getString("src.dir");
        return src;
    }

    public String getDestDir() {
        String dest = configuration.getString("dest.dir");
        return dest;
    }
}
